{% extends "base.html" %}

{% block boxname %}Profile{% endblock %}

{% block content %}
{% if request.user.is_authenticated %}
    <h1>{{ request.user.username }}'s profile</h1>
    {% if request.user.email %}<b>Email:</b> {{ request.user.email }}<br />{% endif %}    
    <b>Profile Type:</b> {{ profile }} <a href="{% url changeprofile %}">(Change profile type)</a><br />
    <i>Warning: Changing profile type will remove all your answers and recommendations</i><br />

{% else %}
    <h1>Guest Profile</h1>
    <b>Profile Type:</b> {{ profile }} <a href="{% url save_progress %}">(Register to change profile)</a>
{% endif %}
<br />
<br />
<h2>Your answered questions</h2>


{% if request.user.is_authenticated %}
    {% if answered_questions %}
        {% for q in answered_questions %}
            {{ q.answer }} <a href="{% url edit input_id=q.question.id %}">(Change Answer)</a>
        
        <br />
        <br />
        
        {% endfor %}
        {% if implicit_answers %}
        <u>Answers that were implicitly answered (Trigger by other answers):</u>
        <br />
        <br />
        {% for im in implicit_answers %}
            {{ im.answer }}
            <br />
        {% endfor %}
        {% endif %}
    {% else %}
        <p>No questions have been answered.</p>
    {% endif %}
{% else %}
    {% if answered_questions %}
    {% for a in answered_questions %}
       {{ a }} <a href="{% url edit input_id=a.id %}">(Change Answer)</a>
        <br />
        <br />    
    {% endfor %}
        <u>Answers that were implicitly answered (Trigger by other answers)</u>
        <br />
        <br />
        {% for im in implicit_answers %}
            {{ im }}
            <br />
        {% endfor %}
    {% else %}
    <p>No questions have been answered.</p>
    {% endif %}
{% endif %}


{% endblock %}
